[0.4.x] libvisual: Address some more warnings#375
Merged
Conversation
…-to-pointer-cast) Symptom was: > lv_bmp.c: In function 'load_uncompressed': > lv_bmp.c:75:61: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] > 75 | uint8_t *end = (uint8_t *) ((int)data & ~1); > | ^ > lv_bmp.c:75:48: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] > 75 | uint8_t *end = (uint8_t *) ((int)data & ~1); > | ^ > lv_bmp.c:96:61: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] > 96 | uint8_t *end = (uint8_t *) ((int)data & ~7); > | ^ > lv_bmp.c:96:48: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] > 96 | uint8_t *end = (uint8_t *) ((int)data & ~7); > | ^
Symptom was: > ./gettext.h:71: error: "gettext_noop" redefined [-Werror] > 71 | #define gettext_noop(String) String > | > ./gettext.h:49: note: this is the location of the previous definition > 49 | # define gettext_noop(Msgid) ((const char *) (Msgid)) > |
Symptom was: > lv_bmp.c: In function 'visual_bitmap_load': > lv_bmp.c:286:9: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 286 | fread (magic, 2, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:294:9: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 294 | fread (&bf_size, 4, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:301:9: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 301 | fread (&bf_bits, 4, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:305:9: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 305 | fread (&bi_size, 4, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:310:17: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 310 | fread (&bi_width, 2, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:311:17: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 311 | fread (&bi_height, 2, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:319:17: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 319 | fread (&bi_bitcount, 2, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:324:17: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 324 | fread (&bi_width, 4, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:325:17: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 325 | fread (&bi_height, 4, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:333:17: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 333 | fread (&bi_bitcount, 2, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:337:17: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 337 | fread (&bi_compression, 4, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lv_bmp.c:344:17: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] > 344 | fread (&bi_clrused, 4, 1, fp); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Symptom was: > ../../libvisual-0.4.2/libvisual/lv_mem.c: In function 'mem_copy_altivec': > ../../libvisual-0.4.2/libvisual/lv_mem.c:379:1: error: no return statement in function returning non-void [-Werror=return-type] > 379 | } > | ^ > ../../libvisual-0.4.2/libvisual/lv_mem.c: In function 'mem_set8_altivec': > ../../libvisual-0.4.2/libvisual/lv_mem.c:529:1: error: no return statement in function returning non-void [-Werror=return-type] > 529 | } > | ^ > ../../libvisual-0.4.2/libvisual/lv_mem.c: In function 'mem_set16_altivec': > ../../libvisual-0.4.2/libvisual/lv_mem.c:673:1: error: no return statement in function returning non-void [-Werror=return-type] > 673 | } > | ^ > ../../libvisual-0.4.2/libvisual/lv_mem.c: In function 'mem_set32_altivec': > ../../libvisual-0.4.2/libvisual/lv_mem.c:784:1: error: no return statement in function returning non-void [-Werror=return-type] > 784 | } > | ^ > ../../libvisual-0.4.2/libvisual/lv_mem.c: At top level: > ../../libvisual-0.4.2/libvisual/lv_mem.c:781:14: error: 'mem_set32_altivec' defined but not used [-Werror=unused-function] > 781 | static void *mem_set32_altivec (void *dest, int c, visual_size_t n) > | ^~~~~~~~~~~~~~~~~ > ../../libvisual-0.4.2/libvisual/lv_mem.c:670:14: error: 'mem_set16_altivec' defined but not used [-Werror=unused-function] > 670 | static void *mem_set16_altivec (void *dest, int c, visual_size_t n) > | ^~~~~~~~~~~~~~~~~ > ../../libvisual-0.4.2/libvisual/lv_mem.c:526:14: error: 'mem_set8_altivec' defined but not used [-Werror=unused-function] > 526 | static void *mem_set8_altivec (void *dest, int c, visual_size_t n) > | ^~~~~~~~~~~~~~~~ > ../../libvisual-0.4.2/libvisual/lv_mem.c:376:14: error: 'mem_copy_altivec' defined but not used [-Werror=unused-function] > 376 | static void *mem_copy_altivec (void *dest, const void *src, visual_size_t n) > | ^~~~~~~~~~~~~~~~
Symptom was: > ../../libvisual-0.4.2/libvisual/lv_video.c: In function 'visual_video_fill_color_rectangle': > ../../libvisual-0.4.2/libvisual/lv_video.c:1766:1: error: label 'out' defined but not used [-Werror=unused-label] > 1766 | out: > | ^~~
Symptom was: > ../../libvisual-0.4.2/libvisual/lv_plugin.c: In function 'plugin_add_dir_to_list': > ../../libvisual-0.4.2/libvisual/lv_plugin.c:605:39: error: '%s' directive output may be truncated writing up to 1023 bytes into a region of size 1022 [-Werror=format-truncation=] > 605 | snprintf (temp, 1023, "%s/%s", dir, namelist[i]->d_name); > | ^~~~~~~ > ../../libvisual-0.4.2/libvisual/lv_plugin.c:605:43: note: format string is defined here > 605 | snprintf (temp, 1023, "%s/%s", dir, namelist[i]->d_name); > | ^~ > ../../libvisual-0.4.2/libvisual/lv_plugin.c:605:17: note: '__builtin_snprintf' output 2 or more bytes (assuming 1025) into a destination of size 1023 > 605 | snprintf (temp, 1023, "%s/%s", dir, namelist[i]->d_name); > | ^~~~~~~~ TRUNC
Symptom was: > ../../libvisual-0.4.2/libvisual/lv_audio.c:129:12: error: 'audio_band_energy' defined but not used [-Werror=unused-function] > 129 | static int audio_band_energy (VisAudio *audio, int band, int length) > | ^~~~~~~~~~~~~~~~~ > ../../libvisual-0.4.2/libvisual/lv_audio.c:115:12: error: 'audio_band_total' defined but not used [-Werror=unused-function] > 115 | static int audio_band_total (VisAudio *audio, int begin, int end) > | ^~~~~~~~~~~~~~~~> ../../libvisual-0.4.2/libvisual/lv_audio.c:129:12: error: 'audio_band_energy' defined but not used [-Werror=unused-function] > 129 | static int audio_band_energy (VisAudio *audio, int band, int length) > | ^~~~~~~~~~~~~~~~~ > ../../libvisual-0.4.2/libvisual/lv_audio.c:115:12: error: 'audio_band_total' defined but not used [-Werror=unused-function] > 115 | static int audio_band_total (VisAudio *audio, int begin, int end) > | ^~~~~~~~~~~~~~~~
Symptom was: > ../../libvisual-0.4.2/libvisual/lv_audio.c:1111:2: error: variable 'signedcorr' is uninitialized when used here [-Werror,-Wuninitialized] > signedcorr += byte_max_numeric (size) / 2; > ^~~~~~~~~~
kaixiong
reviewed
Dec 24, 2024
| /* Unpack 4 bpp pixels aka 2 pixels per byte */ | ||
| uint8_t *col = data - video->pitch; | ||
| uint8_t *end = (uint8_t *) ((int)data & ~1); | ||
| uint8_t *end = (uint8_t *) ((uintptr_t)data & ~1); |
Member
There was a problem hiding this comment.
Wow, this is atrocious. This arithmetic trick also depends on the memory alignment of the data pointer to be 8 bytes or more, but this assumption seems to be relatively safe.
kaixiong
approved these changes
Dec 24, 2024
Member
Author
|
@kaixiong thanks for the review! 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.